package UI

/*
import (
	. "Go3d"
	"container/list"
)

func getWindowSize() (Width, Height int) {
	return WinRoot.Width, WinRoot.Height
}

func init() {
	Layout.Layouts = list.New()
	AddResizeHandler(LayoutWinReSize)
}

func LayoutWinReSize(width, height int) {
	for e := Layout.Layouts.Front(); e != nil; e = e.Next() {
		e.Value.(ILayout).UpdateLayout()
	}
}

//Layout///////////////////////////////////////////
var (
	Layout layout
)

type layout struct {
	Layouts *list.List
}
type ILayout interface {
	UpdateLayout()
}

func (l *layout) Add(layt ILayout) {
	l.Layouts.PushBack(layt)
}

//WrapPanel///////////////////////////////////////////////
const (
	WRAPTYPR_XAUTO = 0
	WRAPTYPR_YAUTO = 1
)

type WrapPanel struct {
	node       INode
	Width      int
	Height     int
	layouttype int
}

func (w *WrapPanel) AttachNode(node INode) {
	w.node = node
}
func CreateWrapPanel() *WrapPanel {
	return CreateWrapPanelWithSize(0, 0)
}

func CreateWrapPanelWithSize(Width, Height int) *WrapPanel {
	RWrapPanel := new(WrapPanel)

	RWrapPanel.Width = Width
	RWrapPanel.Height = Height

	if RWrapPanel.Width == 0 {
		RWrapPanel.Width, _ = getWindowSize()
	}
	if RWrapPanel.Height == 0 {
		_, RWrapPanel.Height = getWindowSize()
	}
	return RWrapPanel
}

func (w *WrapPanel) UpdateLayout() {
	if w.layouttype == WRAPTYPR_XAUTO {
		w._updatelayout_X()
	} else if w.layouttype == WRAPTYPR_YAUTO {

	}
}

func (w *WrapPanel) _updatelayout_X() {
	//for i := 0; i < w.childrens.GetSize(); i++ {

	//}
}

//锚点///////////////////////////////////
const (
	ANCHOR_TOPLEFT = iota
	ANCHOR_TOP
	ANCHOR_TOPRIGHT
	ANCHOR_BOTTOM
	ANCHOR_BOTTOMLEFT
	ANCHOR_BOTTOMRIGHT
	ANCHOR_LEFT
	ANCHOR_RIGHT
)

type Anchor struct {
	Compnent
	AnchorType int
}

func CAnchor(b bool, n INode) (ICompnent, string) {
	if b {
		RAnchor := new(Anchor)
		n.AddCompnent(CUINode)
		RAnchor.CSetNode(n)
		Layout.Add(RAnchor)
		RAnchor.UpdateLayout()
		return RAnchor, "Anchor"
	}
	return nil, "Anchor"
}

func (a *Anchor) UpdateLayout() {
	NEWX, NEWY, NEWZ := a.CGetNode().GetTransfrom().GetPosition()
	if a.AnchorType == ANCHOR_LEFT || a.AnchorType == ANCHOR_TOPLEFT {
		Win_Width, _ := getWindowSize()
		NEWX = float32(float32(Win_Width) * -0.5)
	}

	if a.AnchorType == ANCHOR_TOP || a.AnchorType == ANCHOR_TOPLEFT || a.AnchorType == ANCHOR_TOPRIGHT {
		_, Win_Height := getWindowSize()
		NEWY = float32(Win_Height) * 0.5
	}

	a.CGetNode().GetTransfrom().SetPosition(NEWX, NEWY, NEWZ)

}
*/
